import req from "/@/api/req";
import { ID, PaginationParam, PaginationResult } from "/@/api/models";

export enum Api {
  memberLevels = "member-levels",
  allMemberLevels = "member-levels/all",
  whitelists = "user-dynamic-whitelists",
  avatars = "default-avatars",
}

export function getWhitelists<T = any>(params: PaginationParam<T>) {
  // console.log("getAppUsers", params);
  return req.get<PaginationResult<any>>(
    {
      params,
      url: Api.whitelists,
    },
    {
      useGlobalLoading: false,
    }
  ) as Promise<PaginationResult<T> | null>;
}

export function getAllMemberLevels() {
  return req.get<MemberLevel[]>(
    {
      url: Api.allMemberLevels,
    },
    {
      useGlobalLoading: false,
    }
  );
}

export interface MemberLevel {
  id?: ID;
  fee: number;
  levelName: string;
  numberOfFreeArticles: number;
  numberOfFreeDynamic: number;
  numberOfFreeMember: number;
  userLevel: string;
}

export interface Avatar {
  id?: ID;
  avatar: string;
  status?: number | boolean;
}
